package com.feiyi.app.activity;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;

import com.blankj.utilcode.util.ActivityUtils;
import com.feiyi.app.MainActivity;
import com.feiyi.app.R;
import com.feiyi.app.base.BaseActivity;

/**
 * 作者 : wlt
 * 创建时间:  2018-07-12
 * QQ : 1346947404
 * 邮箱:wanglt_android@163.com
 * 类说明:
 * In me the tiger sniffs the rose
 */

public class SplashActivity extends BaseActivity {
    public int total = 3000;

    private int current = 0;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        handler.sendEmptyMessage(0);
    }
    private Handler handler = new Handler(){

        @Override
        public void handleMessage(Message msg) {
            switch (msg.what){
                case 0:
                    if (current < total){
                        current+=10;
                        handler.sendEmptyMessageDelayed(0,10);
                    }else {
                        current = 0;
                        ActivityUtils.startActivity(SplashActivity.this, MainActivity.class);
                        finish();
                    }
                    break;

            }
        }
    };
}
